//
//  SearchPromptPageView.m
//  BaseTdkc
//
//  Created by DavidHuang on 16/7/1.
//  Copyright © 2016年 黄栋炜. All rights reserved.
//

#import "SearchPromptPageView.h"

@interface SearchPromptPageView ()

@property (nonatomic, strong)UILabel *titleLb;

@property (nonatomic, strong)UIImageView *promptPageImg;

@end

@implementation SearchPromptPageView

-(instancetype)init{
    if (self = [super init]) {
        self.frame = CGRectMake(0, 0, screenW, screenH - pixelValue(100) - navHeight);
        [self addSubview:self.titleLb];
        [self addSubview:self.promptPageImg];
        [self addSubview:self.reloadBtn];
        [self layoutLocation];
    }
    return self;
}

- (UILabel *)titleLb {
    if (_titleLb == nil) {
        _titleLb = [[UILabel alloc] init];
        _titleLb.font = [UIFont fontSizeTwoText];
        _titleLb.textColor = [UIColor colorOfTwoTextColor];
        _titleLb.textAlignment = NSTextAlignmentCenter;
    }
    
    return _titleLb;
}

- (UIImageView *)promptPageImg {
    if (_promptPageImg == nil) {
        _promptPageImg = [[UIImageView alloc] init];
        _promptPageImg.contentMode = UIViewContentModeScaleAspectFit;
        //        _promptPageImg.image = [UIImage imageNamed:@"no_info"];
        
    }
    return _promptPageImg;
}

- (UIButton *)reloadBtn {
    if (_reloadBtn == nil) {
        _reloadBtn = [[UIButton alloc]init];
        
        [_reloadBtn setTitle:@"重新加载" forState:UIControlStateNormal];
        [_reloadBtn setTitleColor:[UIColor colorOfTwoTextColor] forState:UIControlStateNormal];
        [_reloadBtn.titleLabel setFont:[UIFont fontSizeThreeText]];
        _reloadBtn.layer.cornerRadius = 3;
        _reloadBtn.clipsToBounds = YES;
        
        _reloadBtn.layer.borderWidth = 1.0f;
        _reloadBtn.layer.borderColor = [UIColor colorOfTwoTextColor].CGColor;
        
    }
    return _reloadBtn;
}


- (void)layoutLocation {
    WS(weakSelf)
    [self.promptPageImg mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(weakSelf).offset(pixelValue(300));
        make.centerX.mas_equalTo(weakSelf);
        
    }];
    [self.titleLb mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(weakSelf.promptPageImg.mas_bottom).offset(pixelValue(28));
        make.centerX.mas_equalTo(weakSelf.promptPageImg);
    }];
    [self.reloadBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(weakSelf.titleLb.mas_bottom).offset(pixelValue(60));
        make.centerX.mas_equalTo(weakSelf.titleLb);
        make.height.mas_equalTo(pixelValue(50));
        make.width.mas_equalTo(pixelValue(170));
    }];
}
-(void)setTitleLbStr:(NSString *)titleLbStr{
    _titleLbStr = titleLbStr;
    self.titleLb.text = titleLbStr;
    
}
-(void)setPromptPageImgStr:(NSString *)promptPageImgStr{
    _promptPageImgStr = promptPageImgStr;
    self.promptPageImg.image = [UIImage imageNamed:promptPageImgStr];
}
-(void)setIsReloadBtn:(BOOL)isReloadBtn{
    _isReloadBtn = isReloadBtn;
    self.reloadBtn.hidden = !isReloadBtn;
}


@end
